<?php
namespace Tbf\Crypto\Password\Verify;
use Tbf\Crypto\Password\VerifyInterface;
/**
* 多种验证方法的集合
 * @deprecated
*/
class VerifyCollection implements VerifyInterface{
	protected $verify_plan_list = null;
	function __construct(array $verify_plan_list){
		$this->verify_plan_list = $verify_plan_list;
	}
	function verify($plain,$hashed){
		$plan = $this->getSupportPlan($hashed);
		if ($plan===null){
			return false;
		}
		return $plan->verify($plain,$hashed);
	}
	function support($hashed){
		$plan = $this->getSupportPlan($hashed);
		if ($plan===null){
			return false;
		}
		return true;
	}
	protected function getSupportPlan($hashed){
		foreach($this->verify_plan_list as $verify_plan){
			if ($verify_plan->support($hashed)){
				return $verify_plan;
			}
		}
		return null;
	}
}